package com.j48.entrancegurad.service.impl;

import com.j48.entrancegurad.mapper.RecordMapper;
import com.j48.entrancegurad.model.Record;
import com.j48.entrancegurad.service.IRecordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

@Service
public class RecordService implements IRecordService {

    @Autowired
    private RecordMapper recordMapper;

    /**
     *
     * @return
     */
    @Override
    public List<Record> selectAll(){
        List<Record> lists=new ArrayList<Record>();
        lists=recordMapper.selectAll();
        if (lists.size()>0){
            return lists;
        }
        return null;
    }

    @Override
    public List<Record> selectByUser(Record record) {
        List<Record> lists=new ArrayList<Record>();
        lists=recordMapper.selectByUser(record);
        if (lists.size()>0){
            return lists;
        }
        return null;
    }

    @Override
    public List<Record> selectByDate(Record record) {
        List<Record> lists=new ArrayList<Record>();
        lists=recordMapper.selectByDate(record);
        if (lists.size()>0){
            return lists;
        }
        return null;
    }

    @Override
    public boolean insert(Record record) {
       if(recordMapper.insert(record)>0){
           return true;
       }else{
           return  false;
       }
    }


}
